package cz.khfotbal.beans;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.model.UploadedFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import cz.khfotbal.dao.DownloadDao;
import cz.khfotbal.dao.PropertyDao;
import cz.khfotbal.domain.DownloadFile;
import cz.khfotbal.domain.Propertykh;

@Component
@Scope(value = "session")
public class PropertyBean {

	@Autowired
	PropertyDao propertyDao;

	private String valuemail;
	private String valuepassword;
	
	public PropertyBean() {
	}

	public void updateEmailSource(){
		Propertykh property = propertyDao.findPropertyByName("mailsource");
		property.setValue(valuemail);
		propertyDao.updateProperty(property);
		
		property = propertyDao.findPropertyByName("mailsourcepass");
		property.setValue(valuepassword);
		propertyDao.updateProperty(property);
	}

	public String getValuemail() {
		return propertyDao.findPropertyByName("mailsource").getValue();
	}

	public void setValuemail(String valuemail) {
		this.valuemail = valuemail;
	}

	public String getValuepassword() {
		return propertyDao.findPropertyByName("mailsourcepass").getValue();
	}

	public void setValuepassword(String valuepassword) {
		this.valuepassword = valuepassword;
	}

	
	

}
